<template>
    <div class="reportFormPage">
        <!--    <topOperation/>-->
        <div class="report-dom">
            <el-row>
                <el-col :span="5" :offset="19">
                    <div class="pageNumBox">
                        <span>第</span>
                        <span class="placeholder-min text-center">&nbsp;{{ form.page }}&nbsp;</span>
                        <span>页，共</span>
                        <span class="placeholder-min text-center">&nbsp;{{ form.totalPage }}&nbsp;</span>
                        <span>页</span>
                    </div>
                </el-col>
            </el-row>
            <div class="topTwoBox">
                <div class="centerName">粉煤灰试验检测报告</div>
                <div class="codeText">
                    <tr>BGLQ09002F</tr>
                </div>
            </div>
            <div class="threeTopBox">
                <div class="left-border">
                    <div class="box-title">检测单位名称：</div>
                    <div class>{{ form.jiancdwmc }}</div>
                </div>
                <div class="right-border">
                    <span>报告编号：</span>
                    <span class="placeholder">{{ form.baogbh }}</span>
                </div>
            </div>
            <div class="table-border">
                <!-- .........................1111111111111111111111111111111......................................................... -->
                <table height="180px" class="top-table">
                    <tbody>
                    <tr>
                        <td height="30" align="center" width="15%">
                            <span style="width:90px;display:inline-block">施工/委托单位</span>
                        </td>
                        <td width="35%" bgcolor="#ffffff">
                            <span>{{ form.shigwtdw }}</span>
                        </td>
                        <td align="center" width="15%">
                            <span style="width:90px;display:inline-block">工程名称</span>
                        </td>
                        <td bgcolor="#ffffff" width="35%">
                            <span>{{ form.gongcmc }}</span>
                        </td>
                    </tr>
                    <tr>
                        <td height="30" align="center" width="15%">
                            <span style="width:90px;display:inline-block">工程部位/用途</span>
                        </td>
                        <td colspan="3">
                            <span>{{ form.gongcbwyt }}</span>
                        </td>
                    </tr>
                    <tr>
                        <td height="40" align="center">样品信息</td>
                        <td class="specimen-border" colspan="3">
                            <span>样品名称：</span>
                            <span :class="{ 'placeholder': !form.yangpmc }">{{ form.yangpmc }}</span>
                            <span>；样品编号：</span>
                            <span :class="{ 'placeholder-long': !form.yangpbh }">{{ form.yangpbh }}</span>
                            <span>；样品数量：</span>
                            <span :class="{ 'placeholder': !form.yangpsl }">{{ form.yangpsl }}</span>
                            <span>；样品状态：</span>
                            <span :class="{ 'placeholder': !form.yangpzt }">{{ form.yangpzt }}</span>
                            <span>；来样时间：</span>
                            <span :class="{ 'placeholder': !form.yangpsj }">{{ form.yangpsj }}</span>
                        </td>
                    </tr>
                    <tr>
                        <td height="50" align="center" width="15%">
                            <span style="width: 90px; display: inline-block">检测依据</span>
                        </td>
                        <td width="35%">
                            <span v-if="isPdf">{{ form.jiancyj }}</span>
                            <el-input v-else type="textarea" v-model="form.jiancyj" :rows="2" class="mark"
                                      @dblclick.native="showBsJiancyjView" readonly/>
                        </td>
                        <td align="center" width="15%">
                            <span style="width: 90px; display: inline-block">判定依据</span>
                        </td>
                        <td width="35%">
                            <span v-if="isPdf">{{ form.pandyj }}</span>
                            <el-input v-else type="textarea" v-model="form.pandyj" :rows="2"
                                      @dblclick.native="showBsJudgeBaseView"
                                      @focus="handleFocus('pandyj')" class="mark"/>
                        </td>
                    </tr>
                    <tr class="bottom-border">
                        <td height="50" align="center">
                            <div>主要仪器设备</div>
                            <div>名称及编号</div>
                        </td>
                        <td colspan="3">
                            <span v-if="isPdf">{{ form.zhuyyqsbmcjbh }}</span>
                            <el-input v-else type="textarea" :rows="2" v-model="form.zhuyyqsbmcjbh"
                                      class="height100 width100 mark"
                                      @dblclick.native="showBsInstrumentView" readonly></el-input>
                        </td>
                    </tr>
                    </tbody>
                </table>
                <table height="40px" class="middle-table">
                    <tr>
                        <td height="30" align="center" width="15%">
                            <span>样品规格</span>
                        </td>
                        <td width="35%" bgcolor="#ffffff">
                            <el-input type="text" v-model="form.guigxh" @focus="handleFocus('guigxh')"/>
                        </td>
                        <td height="25" align="center" width="15%">
                            <span>代表数量</span>
                        </td>
                        <td width="13%" bgcolor="#ffffff">
                            <el-input type="text" v-model="form.daibsl" @focus="handleFocus('daibsl')"/>
                        </td>
                        <td height="25" align="center" width="9%">
                            <span>批号</span>
                        </td>
                        <td width="13%" bgcolor="#ffffff">
                            <el-input type="text" v-model="form.pih" @focus="handleFocus('pih')"/>
                        </td>
                    </tr>
                </table>
                <table height="40px" class="middle-table">
                    <tr>
                        <td height="30" align="center" width="15%">
                            <span style="width:90px;display:inline-block">进场日期</span>
                        </td>
                        <td width="35%" bgcolor="#ffffff">
                            <el-input type="text" v-model="form.jincrq" @focus="handleFocus('jincrq')"/>
                        </td>
                        <td height="25" align="center" width="15%">
                            <span style="width:90px;display:inline-block">取样位置</span>
                        </td>
                        <td width="35%" bgcolor="#ffffff">
                            <el-input type="text" v-model="form.quydd" @focus="handleFocus('quydd')"/>
                        </td>
                    </tr>
                </table>
                <table height="40px" class="middle-table">
                    <tr>
                        <td height="30" align="center" width="15%">
                            <span style="width:90px;display:inline-block">出厂日期</span>
                        </td>
                        <td width="35%" bgcolor="#ffffff">
                            <el-input type="text" v-model="form.chucrq" @focus="handleFocus('chucrq')"/>
                        </td>
                        <td height="25" align="center" width="15%">
                            <span style="width:90px;display:inline-block">生产厂家</span>
                        </td>
                        <td width="35%" bgcolor="#ffffff">
                            <el-input type="text" v-model="form.cd" @focus="handleFocus('cd')"/>
                        </td>
                    </tr>
                </table>
                <!-- .................................22222222222222222222222222222222............................................... -->
                <table height="500px" class="middle-table">
                    <tbody>
                    <tr style="height: 35px;">
                        <td colspan="1" class="td1">序号</td>
                        <td colspan="4" class="td4">检测项目</td>
                        <td colspan="3" class="td3">技术指标</td>
                        <td colspan="3" class="td3">检测结果</td>
                        <td colspan="3" class="td3">结果判定</td>
                    </tr>

                    <tr>
                        <td colspan="1" rowspan="1" class="td1">1</td>
                        <td colspan="4" class="td1">含水量(%)</td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[93].jiszb" class="mark"
                                      @dblclick.native="showBsJudgeBaseEditView('93')" readonly/>
                        </td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[93].jiancjg" disabled/>
                        </td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[93].jiegpd" disabled/>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="1" rowspan="1" class="td1">2</td>
                        <td colspan="4" class="td1">烧失量(%)</td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[94].jiszb" class="mark"
                                      @dblclick.native="showBsJudgeBaseEditView('94')" readonly/>
                        </td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[94].jiancjg" disabled/>
                        </td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[94].jiegpd" disabled/>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="1" rowspan="1" class="td1">3</td>
                        <td colspan="4" class="td1">SO<sub>3</sub>含量(%)</td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[95].jiszb" class="mark"
                                      @dblclick.native="showBsJudgeBaseEditView('95')" readonly/>
                        </td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[95].jiancjg" disabled/>
                        </td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[95].jiegpd" disabled/>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="1" rowspan="1" class="td1">4</td>
                        <td colspan="4" class="td1">需水量比(%)</td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[96].jiszb" class="mark"
                                      @dblclick.native="showBsJudgeBaseEditView('96')" readonly/>
                        </td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[96].jiancjg" disabled/>
                        </td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[96].jiegpd" disabled/>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="1" rowspan="1" class="td1">5</td>
                        <td colspan="4" class="td1">游离氧化钙含量(%)</td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[97].jiszb" class="mark"
                                      @dblclick.native="showBsJudgeBaseEditView('97')" readonly/>
                        </td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[97].jiancjg" disabled/>
                        </td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[97].jiegpd" disabled/>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="1" rowspan="1" class="td1">6</td>
                        <td colspan="4" class="td1">安定性(m)</td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[98].jiszb" class="mark"
                                      @dblclick.native="showBsJudgeBaseEditView('98')" readonly/>
                        </td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[98].jiancjg" disabled/>
                        </td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[98].jiegpd" disabled/>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="1" rowspan="2" class="td1">7</td>
                        <td colspan="2" class="td1" rowspan="2">活性指数(%)</td>
                        <td colspan="2" class="td1" rowspan="1">{{form.huoxzx1}}d</td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[99].jiszb" class="mark"
                                      @dblclick.native="showBsJudgeBaseEditView('99')" readonly/>
                        </td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[99].jiancjg" disabled/>
                        </td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[99].jiegpd" disabled/>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" class="td1" rowspan="1">{{form.huoxzx2}}d</td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[105].jiszb" class="mark"
                                      @dblclick.native="showBsJudgeBaseEditView('105')" readonly/>
                        </td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[105].jiancjg" disabled/>
                        </td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[105].jiegpd" disabled/>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="1" rowspan="1" class="td1">8</td>
                        <td colspan="4" class="td1">细度(%)</td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[100].jiszb" class="mark"
                                      @dblclick.native="showBsJudgeBaseEditView('100')" readonly/>
                        </td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[100].jiancjg" disabled/>
                        </td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[100].jiegpd" disabled/>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="1" rowspan="1" class="td1">9</td>
                        <td colspan="4" class="td1">氧化铁+氧化铝+二氧化硅含量(%)</td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[101].jiszb" class="mark"
                                      @dblclick.native="showBsJudgeBaseEditView('101')" readonly/>
                        </td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[101].jiancjg" disabled/>
                        </td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[101].jiegpd" disabled/>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="1" rowspan="1" class="td1">10</td>
                        <td colspan="4" class="td1">比表面积(m<sup>2</sup>/kg)</td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[102].jiszb" class="mark"
                                      @dblclick.native="showBsJudgeBaseEditView('102')" readonly/>
                        </td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[102].jiancjg" disabled/>
                        </td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[102].jiegpd" disabled/>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="1" rowspan="1" class="td1">11</td>
                        <td colspan="4" class="td1">流动度比(%)</td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[103].jiszb" class="mark"
                                      @dblclick.native="showBsJudgeBaseEditView('103')" readonly/>
                        </td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[103].jiancjg" disabled/>
                        </td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[103].jiegpd" disabled/>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="1" rowspan="1" class="td1">12</td>
                        <td colspan="4" class="td1">密度(g/cm<sup>2</sup>)</td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[104].jiszb" class="mark"
                                      @dblclick.native="showBsJudgeBaseEditView('104')" readonly/>
                        </td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[104].jiancjg" disabled/>
                        </td>
                        <td colspan="3" class="td3">
                            <el-input type="text" v-model="form.baDetailVos[104].jiegpd" disabled/>
                        </td>
                    </tr>
                    </tbody>
                </table>
                <!-- .....................................................33333333333333333................................................... -->
                <table height="120px" class="bottom-table">
                    <tr>
                        <td colspan="14" height="60px" style="border-bottom-width: 1px;">
                            <span v-if="isPdf" class="textarea-span">{{ form.jiancjl }}</span>
                            <el-input v-else type="textarea" :rows="2" v-model="form.jiancjl"
                                      @focus="handleFocus('jiancjl')"
                                      @dblclick.native="getJcjl()"/>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <span v-if="isPdf" class="textarea-span">{{ form.fujsm }}</span>
                            <el-input v-else type="textarea" :rows="2" v-model="form.fujsm"
                                      @focus="handleFocus('fujsm')"/>
                        </td>
                    </tr>
                </table>
            </div>
            <!-- .................................44444444444............................................. -->
            <table height="22px" class="transparent">
                <tbody>
                <tr>
                    <td width="10%" align="right">检测：</td>
                    <td width="15%" align="left"></td>
                    <td width="10%" align="right">审核：</td>
                    <td width="15%" align="left"></td>
                    <td width="10%" align="right">批准：</td>
                    <td align="left" width="15%"></td>
                    <td width="10%">日期：</td>
                    <td align="left" width="15%">
                        <div style="display: inline-block; margin-left: 20px">年</div>
                        <div style="display: inline-block; margin-left: 20px">月</div>
                        <div style="display: inline-block ;margin-left: 20px">日</div>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
        <bs-instrument-view ref="bsInstrumentViewRef" @select="selectInstrument"></bs-instrument-view>
        <bs-jiancyj-view ref="bsJiancyjViewRef" @select="selectJiancyj" :syType="syType"></bs-jiancyj-view>
        <bs-judge-base-view ref="bsJudgeBaseViewRef" @select="selectJudge" :syType="syType"></bs-judge-base-view>
        <bs-judge-base-edit-view ref="bsJudgeBaseEditViewRef" @submit="selectJudgeBaseEdit"
                                 :syType="syType"></bs-judge-base-edit-view>
    </div>
</template>

<script>
import {handleFocus, emptyConvert, uniqueStr} from "@/views/reportForms/utils";
import {getChlFmhbgBsInfo, queryJcjl} from "@/api/report_chl/chlFmhbgBsInfo";
import {computeBiQualification} from "@/api/sycs/biQualification";
import BsJudgeBaseView from "@/views/sycs/bsJudgeBase/BsJudgeBaseView.vue";
import BsInstrumentView from "@/views/dept/bsInstrument/BsInstrumentView.vue";
import BsJiancyjView from "@/views/sycs/bsJiancyj/BsJiancyjView.vue";
import BsJudgeBaseEditView from "@/views/sycs/bsJudgeBase/BsJudgeBaseEditView.vue";
import decimal from "@/utils/big-decimal";
import Bus from "@/utils/bus";

export default {
    name: "fmhbg",
    components: {
        BsJudgeBaseView,
        BsInstrumentView,
        BsJiancyjView,
        BsJudgeBaseEditView
    },
    props: {
        excelId: {
            type: [String, Number],
            default: () => ""
        },
        syType: {
            type: [String, Number],
            default: () => ""
        },
        page: {
            type: Number,
            default: () => 0
        },
        isPdf: {
            type: Boolean,
            default: () => false
        },
        printEmpty: {
            type: Boolean,
            default: () => false
        }
    },
    data() {
        return {
            // 表单参数
            form: {
                baDetailVos: {
                    93: {}, // 含水量
                    94: {}, // 烧失量
                    95: {}, // SO3含量
                    96: {}, // 需水量比
                    97: {}, // 游离氧化钙含量
                    98: {}, // 安定性
                    99: {}, // 活性指数1
                    105: {}, // 活性指数2
                    100: {}, // 细度
                    101: {}, // 氧化铁+氧化铝+二氧化硅含量
                    102: {}, // 比表面积
                    103: {}, // 流动度比
                    104: {} // 密度
                }
            }
        };
    },
    watch: {
        isPdf(newVal, oldVal) {
            this.form = {...emptyConvert(this.form, newVal)};
        }
    },
    created() {
        // console.log("this.excelId: ", this.excelId);
        this.getInfo();
    },
    mounted() {
        // 检测依据
        Bus.$on("setFmhBgJiancyj", (data) => {
            const {jiancyj, jiancyjIds} = data;
            const str = jiancyj + (this.form.jiancyj ? "、" + this.form.jiancyj : "");
            const ids = jiancyjIds + (this.form.jiancyjIds ? "," + this.form.jiancyjIds : "");
            this.form.jiancyj = uniqueStr(str, "、");
            this.form.jiancyjIds = uniqueStr(ids, ",");
        });
        // 主要设备
        Bus.$on("setFmhBgZhuyyqsbmcjbh", (data) => {
            const {zhuyyqsbmcjbh, shebIds} = data;
            const str = zhuyyqsbmcjbh + (this.form.zhuyyqsbmcjbh ? "、" + this.form.zhuyyqsbmcjbh : "");
            const ids = shebIds + (this.form.shebIds ? "," + this.form.shebIds : "");
            this.form.zhuyyqsbmcjbh = uniqueStr(str, "、");
            this.form.shebIds = uniqueStr(ids, ",");
        });
        // 各报表给报告传值
        Bus.$on("setFmhBgJiancjg", (data) => {
            if (data.length <= 0) {
                return;
            }
            let count = 0;
            data.forEach((item) => {
                if (!this.form.baDetailVos[item.key] || !this.form.baDetailVos[item.key].qualId) {
                    return;
                }
                if (this.form.baDetailVos[item.key].jiancjg == item.value) {
                    count++;
                }
            });

            if (count == data.length) {
                return;
            }
            let keys = [];
            let flg = false;
            data.forEach((item) => {
                if (!this.form.baDetailVos[item.key] || !this.form.baDetailVos[item.key].qualId) {
                    return;
                }
                this.form.baDetailVos[item.key].jiancjg = item.value;
                if (!flg && this.form.baDetailVos[item.key].symbolValue) {
                    flg = true;
                } else {
                    this.form.baDetailVos[item.key].jiegpd = "实测值";
                }
                keys.push(item.key);
            });
            if (flg) {
                this.computeDetectionResult(keys);
            }
        });

        // 粉煤灰活性指数试验检测记录表-活性指数传值
        Bus.$on("setFmhsyjcBgBase", (data) => {
            this.$set(this.form,'huoxzx1',data.hxzsDay1 || null)
            this.$set(this.form.baDetailVos[99],'jiancjg',data.hxzs1 || null)
            this.$set(this.form,'huoxzx2',data.hxzsDay2 || null)
            this.$set(this.form.baDetailVos[105],'jiancjg',data.hxzs2 || null)
        });
    },
    beforeDestroy() {
        // 或者你可以使用其他合适的生命周期钩子
        // 停止监听事件
        Bus.$off("setFmhBgJiancyj");
        Bus.$off("setFmhBgZhuyyqsbmcjbh");
        Bus.$off("setFmhBgJiancjg");
        Bus.$off("setFmhsyjcBgBase");
    },
    methods: {
        // 获取详情
        getInfo() {
            if (!this.excelId) {
                const {jiancdwmc, gongcmc, constructionCompany} = this.$store.state.dept.deptInfo;
                this.form.jiancdwmc = jiancdwmc;
                this.form.gongcmc = gongcmc;
                this.form.shigwtdw = constructionCompany;
                this.form.jiancjl = "检测结论：";
                this.form.fujsm = "附加声明：";
                return;
            }
            getChlFmhbgBsInfo(this.excelId).then((response) => {
                this.form = response.data;
                if (!this.form.jiancjl) {
                    this.form.jiancjl = "检测结论：";
                }
                if (!this.form.fujsm) {
                    this.form.fujsm = "附加声明：";
                }
                for (const key in this.form.baDetailVos) {
                    if (Object.hasOwnProperty.call(this.form.baDetailVos, key)) {
                        const element = this.form.baDetailVos[key];
                        this.form.baDetailVos[key].jiancjg;
                        if (!this.form.baDetailVos[key].jiancjg) {
                            this.form.baDetailVos[key].jiancjg = "-";
                        }
                    }
                }
            });
        },
        // 显示检测依据列表
        showBsJiancyjView() {
            this.$refs.bsJiancyjViewRef.init(this.form.jiancyjIds);
        },
        // 检测依据选择
        selectJiancyj(info) {
            this.form.jiancyj = info.label;
            this.form.jiancyjIds = info.ids;
        },
        // 显示判定依据列表
        showBsJudgeBaseView() {
            this.$refs.bsJudgeBaseViewRef.init(this.form.pandyjIds);
        },
        // 判断依据选择
        selectJudge(info) {
            if (!info || !info.label) {
                return;
            }
            this.form.pandyjIds = info.ids;
            this.form.pandyj = info.label;
            // 添加指标 info.list
            let keys = [];
            info.list.forEach((item) => {
               if (this.form.baDetailVos[item.refQualId] && this.form.baDetailVos[item.refQualId].jiancjg) {
                    this.form.baDetailVos[item.refQualId].symbolValue = item.symbolValue;
                    this.form.baDetailVos[item.refQualId].num1 = item.num1;
                    this.form.baDetailVos[item.refQualId].num2 = item.num2;
                    keys.push(item.refQualId);
                }
            });
            this.computeDetectionResult(keys);
        },
        // 显示仪器列表
        showBsInstrumentView() {
            this.$refs.bsInstrumentViewRef.init(this.form.shebIds);
        },
        // 仪器选择
        selectInstrument(info) {
            this.form.zhuyyqsbmcjbh = info.label;
            this.form.shebIds = info.ids;
        },
        // 显示单个技术编辑
        showBsJudgeBaseEditView(key) {
            const info = this.form.baDetailVos[key];
            info.refQualId = info.qualId;
            this.$refs.bsJudgeBaseEditViewRef.init(info);
        },
        // 编辑单个技术指标后赋值
        selectJudgeBaseEdit(info) {
            if (info.qualId) {
                this.form.baDetailVos[info.qualId] = info;
            }
            this.computeDetectionResult([info.qualId]);
        },
        // 计算检测结果
        computeDetectionResult(keys) {
            if (!keys || keys.length <= 0) {
                return;
            }
            const data = keys.map((key) => {
                const info = {
                    ...this.form.baDetailVos[key],
                    jiancjg: this.form.baDetailVos[key].jiancjg == "-" ? "" : this.form.baDetailVos[key].jiancjg
                };
                return info;
            });
            computeBiQualification(data).then((res) => {
                const returnData = res.data;
                returnData.forEach((item) => {
                    if (!item.symbolValue && !item.num1 && !item.num2) {
                        item.jiszb = "-";
                    }
                    item.jiancjg = item.jiancjg ? item.jiancjg : "-";
                    this.form.baDetailVos[item.qualId] = item;
                });
            });
        },
        // 获取检测结论
        getJcjl() {
            const form = JSON.parse(JSON.stringify(this.form));
            queryJcjl(emptyConvert(form)).then((res) => {
                const info = res.data;
                this.form.jiancjl = info.jiancjl;
            });
        },
        submitForm() {
            return this.form;
        },
        handleFocus(event) {
            handleFocus(event, this.page, this.form[event]);
        }
    }
};
</script>

<style scoped>
.td1 {
    width: calc(100% / 14 * 1);
}

.td2 {
    width: calc(100% / 14 * 2);
}

.td3 {
    width: calc(100% / 14 * 3);
}

.td4 {
    width: calc(100% / 14 * 4);
}

.td5 {
    width: calc(100% / 14 * 5);
}
</style>
